package za.co.smartmi.service.exception;

import za.co.smartmi.server.model.ErrorType;
import za.co.smartmi.server.model.Profile;
import za.co.smartmi.server.model.ServiceError;
import za.co.smartmi.util.ResourcesUtil;
import za.co.smartmi.util.StackTraceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ServiceExceptionFactory
{
        private static Logger log = LoggerFactory.getLogger(ServiceExceptionFactory.class);
	/**
	 * Method 'createServiceException'
	 * 
	 * @return ServiceException
	 */
	public static ServiceException createServiceException(String errorKey, Throwable ex)
	{
            log.debug(StackTraceUtil.getStackTrace(ex));
            return new ServiceException(ErrorType.FIND_ERR + ":" + ResourcesUtil.getInstance().getProperty(errorKey),
                    new ServiceError(ErrorType.FIND_ERR,errorKey,ResourcesUtil.getInstance().getProperty(errorKey)));
        }
        
        
        
}
